package server.service.medicalservice;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import domain.records.MedicalService;
import domain.session.Response;

public class ServiceAction {
	
	private ServiceModel serviceModel;
	
	public ServiceAction() {
		serviceModel = new ServiceModel();
	}
	
	public Response getAllServices(final JSONObject requestJson) {
		List<MedicalService> services = serviceModel.getAllServices();
		JSONArray servicesArray = new JSONArray();
		for (MedicalService service : services) {
			servicesArray.put(service.getJSON());
		}
		JSONObject responseJson = new JSONObject();
		responseJson.put("services", servicesArray);
		Response response = new Response(true, responseJson);
		return response;
	}

}
